import React, { Component } from "react";
import { BrowserRouter as Router, Route, Link, Redirect, Switch } from "react-router-dom";
import { Layout, Menu, Select, Dropdown, Icon, Button, Tabs, Modal, Alert, Form, Input, Tooltip, message, Upload, Table, Popconfirm, Divider, Row, Col, Tag, Checkbox } from 'antd'
import { iconFontUrl, inspectitemUploadTemplateUrl, memberUploadTemplateUrl } from "../js/config.js";
import icon from "../img/icon.png";
import {PagePatrol} from '../components/bigscreen.jsx'
const { Content, Sider, Header } = Layout;
const IconFont = Icon.createFromIconfontCN({
    scriptUrl: iconFontUrl,
});

class EducationPage extends Component {
    constructor(props) {
        super(props);
        let url = document.location.href;
        let page = url.split("/")[5];
        let defaultSelectedKeys;
        switch (page) {
        case "permissionitem":
            defaultSelectedKeys = "permissionitem"; break;
        case "permissionset":
            defaultSelectedKeys = "permissionset"; break;
        case "inspectitemdeploy":
            defaultSelectedKeys = "inspectitemdeploy"; break;
        case "publiclistdeploy":
            defaultSelectedKeys = "publiclistdeploy"; break;
        case "publiczhizhouitemdeploy":
            defaultSelectedKeys = "publiczhizhouitemdeploy"; break;
        default: defaultSelectedKeys = "permissionitem";
        }
        this.state = {
            defaultSelectedKeys: [defaultSelectedKeys],
            collapsed: false,
        };
    }

    onCollapse = (collapsed) => {
        //console.log(collapsed);
        if (collapsed) {
            document.getElementById("logoName").style.display = "none";
        } else {
            document.getElementById("logoName").style.display = "inline";
        }
        this.setState({ collapsed });
    }

    logOff() {
        sessionStorage.setItem("username", null);
        sessionStorage.setItem("identityId", null);
        sessionStorage.setItem("departmentId", null);
        this.props.history.push("/");
    }

    render() {
        return (
            <Router basename="/education">
                <Layout>
                    <Sider
                        collapsible
                        collapsed={this.state.collapsed}
                        onCollapse={this.onCollapse}
                        width={256}
                        style={{
                            overflow: "auto",
                            height: "100vh",
                            left: 0
                        }}>
                        <div className="logo" >
                            {/* <IconFont type="icon-anfang" className='icon' style={{ verticalAlign: "middle", }} /> */}
                            <img src={icon} className='icon' style={{
                                verticalAlign: 'middle',
                                width: '30px',
                                height: '30px',
                                marginRight: '5px'
                            }} />
                            <div
                                id='logoName'
                                style={{ verticalAlign: 'middle', display: 'inline-block', paddingLeft: "5px" }}>
                                梯度智慧安监
                            </div>
                        </div>
                        <Menu theme="dark" mode="inline" defaultSelectedKeys={this.state.defaultSelectedKeys}>
                            <Menu.Item key="educationpatrol">
                                <Link to="/educationpatrol">
                                    <IconFont type="icon-xunluo" className='icon' />
                                    <span className="nav-text">巡更</span>
                                </Link>
                            </Menu.Item>
                            <Menu.Item key="educationpolling">
                                <Link to="/educationpolling">
                                    <IconFont type="icon-xunjian" className='icon' />
                                    <span className="nav-text">巡检</span>
                                </Link>
                            </Menu.Item>
                            <Menu.Item key="educationschoolinnergrid">
                                <Link to="/educationschoolinnergrid">
                                    <IconFont type="icon-wangge1" className='icon' />
                                    <span className="nav-text">校内网格</span>
                                </Link>
                            </Menu.Item>
                            <Menu.Item key="educationschooloutgrid">
                                <Link to="/educationschooloutgrid">
                                    <IconFont type="icon-xiaowaizhuanye" className='icon' />
                                    <span className="nav-text">校外网格</span>
                                </Link>
                            </Menu.Item>
                            <Menu.Item key="educationdutyweek">
                                <Link to="/educationdutyweek">
                                    <IconFont type="icon-kaoqin" className='icon' />
                                    <span className="nav-text">值周</span>
                                </Link>
                            </Menu.Item>
                        </Menu>
                    </Sider>
                    <Layout style={{ height: "100vh" }}>
                        <Header style={{
                            background: '#fcfcfc',
                            padding: 0,
                            fontFamily: 'Microsoft Yahei, sans-serif',
                            fontSize: 15,
                            position: 'relative',
                            height: '64px',
                            lineHeight: '64px',
                        }}>
                            <div style={{ position: "absolute", top: 0, bottom: 0, left: 24, }}>
                                欢迎您！您的身份为<span style={{ color: '#1890ff' }}>权限管理员</span>
                            </div>
                            <div style={{ position: "absolute", top: 0, bottom: 0, right: 24, }}>
                                <Dropdown overlay={
                                    <Menu>
                                        <Menu.Item>
                                            <a
                                                class='logOff'
                                                style={{ color: '#333333', padding: '5px 15px' }}
                                                onClick={() => this.logOff()}>
                                                <IconFont
                                                    type="icon-zhuxiaologout11" className='icon'
                                                    style={{ fontSize: '14px', verticalAlign: 'middle' }} />
                                                <span style={{ verticalAlign: 'middle', marginLeft: '2px' }}>退出登录</span>
                                            </a>
                                        </Menu.Item>
                                    </Menu>
                                }>
                                    <div
                                        className='dropdown'
                                        style={{
                                            padding: '0px 5px'
                                        }}>
                                        <IconFont
                                            style={{ fontSize: '28px', verticalAlign: 'middle' }}
                                            type="icon-touxiang-shi" className='icon' />
                                        <span style={{ marginLeft: '2px' }}>{sessionStorage.getItem("username")}</span>
                                    </div>
                                </Dropdown>
                            </div>
                        </Header>
                        <Content style={{ margin: "24px", overflow: "initial" }}>
                            <div
                                id="right"
                                style={{
                                    padding: 24,
                                    background: "#fff",
                                    height: "auto",
                                    marginBottom: 24
                                }}
                            >
                           <Switch>
                               
                                    <Route path="/educationpatrol" component={PagePatrol} />
                                    <Route path="/educationpolling" component={PagePatrol} />
                                    <Route path="/educationschoolinnergrid" component={PagePatrol} />
                                    <Route path="/educationschooloutgrid" component={PagePatrol} />
                                    <Route path="/educationdutyweek" component={PagePatrol} />
                             
                             
                                
                                </Switch>
                            </div>
                        </Content>
                        {/* <Footer style={{ textAlign: "center", background: '#fcfcfc', }}>绍兴市教育局</Footer> */}
                    </Layout>
                </Layout>
            </Router>
        );
    }
}




 class EducationPolling extends Component {


    render() {
        return (
            <div>
                <div>
                    
                </div>
            </div>
        )
    }
}









export default EducationPage;
export {   };